{% extends 'template.html' %}

{% block username %}
    {{ request.user.username }}
{% endblock %}

{% block content %}
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">权限更改记录</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <table id="mytable" class="display" width="100%" cellspacing="0"
                               class="table table-striped table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>操作时间</th>
                                <th>操作人</th>
                                <th>操作对象</th>
                                <th>权限变化</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for x in all_record %}
                                <tr>
                                    <td>{{ x.create_time|date:"Y-m-d H:i:s" }}</td>
                                    <td>{{ x.operation_user }}</td>
                                    <td>
                                        {% if x.object == 1 %}{{ x.get_object_display }}：{{ x.change_department.name }}{% endif %}
                                        {% if x.object == 2 %}{{ x.get_object_display }}：{{ x.change_user }}{% endif %}
                                    </td>
                                    <td>{{ x.change_content }}</td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block bodyjs %}
    <script src="/static/js/jquery.dataTables.min.js"></script>
    <script>
        $(document).ready(function () {
            $('#mytable').DataTable({
                responsive: true,
                language: {
                    "url": "/static/js/i18n/Chinese.json"
                },
                ordering: false,
            });
        });
    </script>
{% endblock %}
{% block css %}
    <link href="/static/css/jquery.dataTables.css" rel="stylesheet" type="text/css">
    <link href="/static/css/mycss.css" rel="stylesheet" type="text/css">
{% endblock %}
